<?
$rightCol  = 1;
$eventMenu = 0;
include('includes/appInit.php');
include('includes/header.php');
$library = new Library();
$errorDivDisplay = 'none';
$searchInitValue = $translate->_('Enter Title or Keyword');

if ($_GET['search'] == 1) {
	/*
	 * Check for valid search term
	 */
	if ( ($_POST['searchText'] == '') || empty($_POST['searchText']) ) {
		$error = 1;
		$errorDivDisplay = '';
		$errorMessage = 'You must enter a search term.';
	} else {
		/*
		 * Perform search
		 */
		$searchResults = $library->searchLibrary($_POST['searchText']);
		$searchInitValue = $_POST['searchText'];
	}
}

?>
	<div id="subPage">
		<div class="leftCol">
		
			<div id="subPageContent" class="flex">
				<h1><?=$translate->_('Search the library'); ?></h1>
				
				<div id="errorMessage" class="errorMessageBig" style="display: <?=$errorDivDisplay; ?>;"><?=$errorMessage; ?></div>
				
				<form action="librarySearch.php?search=1" method="POST">
					<div style="float: left;"><input type="text" name="searchText" class="bigSearchBox" value="<?=$searchInitValue; ?>" onFocus="this.value='';" /></div>
					<div style="float: left;"><input style="margin: -3px 0 0 25px;" type="submit" value="<? echo $translate->_('Search'); ?>" class="buttonSearch" title="<? echo $translate->_('Search'); ?>" /></div>
					<div style="clear: left;"></div>			
				</form>
												
				<p style="margin-top: 10px;">
					<?=$searchResults; ?>
				</p>
				
				<p style="height: 100px;"></p>
			</div>
		</div>
		<div class="rightCol noPrint">
			<div class="rightColInner flex" style="height: 500px;">
				<? include('includes/rightColumn.php'); ?>
			</div>
		</div>
		<div style="clear: both;"></div>
	</div>	
	
	
<?
include('includes/footer.php');
?>